<template>
    <div>
        <Timeline v-if="data.length > 0" class="ivu-pt-16 main-height">
            <TimelineItem v-for="(items, index) in data" :key="'journal-'+index">
                <p class="time">{{items.created_at_str}}</p>
                <p class="content">{{items.action_content}}</p>
                <p class="consultant">
                    <span class="c-inr-right" v-if="items.profession_name">{{items.profession_name}}</span>
                    <span class="c-inr-right" v-if="items.operate_name">{{items.operate_name}}</span>
                    <Badge status="processing" :text="items.action_type_str" />
                </p>
            </TimelineItem>
        </Timeline>
        <div v-else class="ivu-pt-16" style="min-height: 200px;text-align: center">暂无操作日志</div>
    </div>
</template>
<script>
    import { LogList } from '@api/patient'

    export default {
        name: 'Journal',
        data () {
            return {
                data: []
            }
        },
        methods: {
            getData (id) {
                const params = {
                    patient_user_id: id,
                    page: 0,
                    pageSize: 0
                }
                LogList(params).then((res) => {
                    this.data = res.list
                }).catch(() => {})
            }
        }
    }
</script>
<style scoped>
.time {
    font-size: 14px;
    font-weight: bold;
}
.content {
    padding: 10px 0;
}
.consultant {
    color: #9ea7b4;
}
.c-inr-right{
    margin-right: 10px;
}
.main-height {
    height: 480px;
    max-height: 480px;
    overflow-y: auto;
}
</style>
